#include <bits/stdc++.h>

#define eb emplace_back
#define ep emplace
#define fi first
#define se second
#define in read<int>()
#define lin read<ll>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using vec = vector < int >;
using veg = vector < pii >;

template < typename T > T read() {
	T x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-', ch = getchar();
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

template < typename T > void chkmax(T &x, const T &y) { x = x > y ? x : y; }
template < typename T > void chkmin(T &x, const T &y) { x = x < y ? x : y; }

const int N = 1e6 + 10;
const int inf = 0x3f3f3f3f;

namespace F {
	const int N = 5010;
	const int M = 3e5 + 10;
	struct edge {
		int v, w, c, nxt;
	} e[M];
	int h[N], cnt = 1, incf[N], pre[N], S, T;
	int dis[N];
	bool v[N];
	ll maxflow, cost;
	void tlink(int u, int v, int w, int c) { e[++cnt] = (edge) { v, w, c, h[u] }; h[u] = cnt; }
	void link(int u, int v, int w, int c) { tlink(u, v, w, c), tlink(v, u, 0, -c); }
	void setst(int s, int t) { S = s, T = t; }
	bool bfs() {
		memset(v, 0, sizeof v); memset(dis, 0x3f, sizeof dis); dis[S] = 0; v[S] = 1; incf[S] = inf;
		queue < int > q; q.ep(S);
		while(q.size()) {
			int x = q.front(); q.pop();
			for(int i = h[x], y; i; i = e[i].nxt)
				if(e[i].w && dis[y = e[i].v] > dis[x] + e[i].c) {
					incf[y] = min(incf[x], e[i].w); dis[y] = dis[x] + e[i].c; pre[y] = i;
					if(!v[y]) q.ep(y), v[y] = true;
				}
			v[x] = false;
		} return dis[T] < inf;
	}
	void update() {
		maxflow += incf[T]; cost += incf[T] * dis[T]; int x = T;
		while(x != S) {
			int i = pre[x];
			e[i].w -= incf[T]; e[i ^ 1].w += incf[T];
			x = e[i ^ 1].v;
		}
	}
	void runit() {
		maxflow = cost = 0; while(bfs()) update(); 
	}
}

int main() {
#ifdef YJR_2333_TEST
	freopen("1.in", "r", stdin);
#endif
	int n = in, m = in, s = in, t = in;
	F :: setst(s, t);
	rep(i, 1, m) {
		int u = in, v = in, w = in, c = in;
		F :: link(u, v, w, c);
	}
	F :: runit();
	cout << F :: maxflow << " " << F :: cost << endl;
	return 0;
}
